package com.cxs.exception.handler;

import com.cxs.vo.Result;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/*
 * @Project:spring-boot-shiro-unless-session
 * @Author:cxs
 * @Motto:放下杂念,只为迎接明天更好的自己
 * */
@RestControllerAdvice
public class ShiroExceptionHandler {

    @ExceptionHandler(AuthorizationException.class)
    public Result authorizationExceptionHandle(AuthorizationException e){
        Result result = new Result();
        result.setCode(HttpStatus.FORBIDDEN.value()).setMsg("权限不足");
        return result;
    }
}
